import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, ObjectId } from 'mongoose';
import * as mongoose from 'mongoose';
import { PhotosType } from './photosType.schema';
import { User } from '@api/user/schemas/user.schema';
import { PhotosProfile } from './photosProfile.schema';
export enum AuditStatus {
    // 进行中
    underway,
    success,
    fail,
}
export type PhotosDocument = Photos & Document;
@Schema()
export class Photos {
    _id: ObjectId;
    /**
     * 类型
     */
    @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'PhotosType', index: true })
    photosType: PhotosType | ObjectId;

    /**
     * 用户
     */
    @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'User', index: true })
    user: User | ObjectId;

    /**
     * profile
     */
    @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'PhotosProfile' })
    profile: PhotosProfile | ObjectId;
    /**
     * 标题
     */
    @Prop({
        required: true,
    })
    title: string;
    /**
     * 描述
     */
    @Prop({
        default: '',
    })
    desc: string;
    /**
     * 创建时间
     */
    @Prop({
        default: Date.now,
    })
    createdAt: Date;
    /**
     * 照片
     */
    @Prop()
    photos: string[];
    /**
     * 审核进度
     */
    @Prop({
        default: AuditStatus.underway,
    })
    auditStatus: AuditStatus;
}

export const PhotosSchema = SchemaFactory.createForClass(Photos);
